"""
The Simplified Whiskas Model Python Formulation for the PuLP Modeller
Authors: Antony Phillips, Dr Stuart Mitchell    2007
"""

from pulp import *

prob = LpProblem("The Whiskas Problem",LpMinimize)

x1 = LpVariable("ChickenPercent",0)
x2 = LpVariable("BeefPercent",0)

prob += 0.013 * x1 + 0.008 * x2, "Total Cost of Ingredients per can"
prob += x1 + x2 == 100, "PercentagesSum"
prob += 0.100 * x1 + 0.200 * x2 >= 8.0, "ProteinRequirement"
prob += 0.080 * x1 + 0.100 * x2 >= 6.0, "FatRequirement"
prob += 0.001 * x1 + 0.005 * x2 <= 2.0, "FibreRequirement"
prob += 0.002 * x1 + 0.005 * x2 <= 0.4, "SaltRequirement"

prob.writeLP("WhiskasModel.lp")

prob.solve()

print "Status:", LpStatus[prob.status]

for variable in prob.variables():
    print variable.name, "=", variable.varValue

print "Total Cost of Ingredients per can = ", value(prob.objective)
